package com.cn.barcode;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

import android.content.Context;

/**
 * @author 
 *
 */
public class ServerModel {
	
	private HttpClient mClient = null;
	
	public ServerModel(Context context){
		mClient = new DefaultHttpClient();
	}
	
	
	/**
	 * 根据uri获得返回的数据
	 * @param uri
	 * @return
	 */
	private String getFromServer(String uri){
		
		HttpResponse response = null;
		
		HttpGet request = new HttpGet(uri);
		
		String ret = "";
		
		try {
			response = mClient.execute(request);
		
			if( null == response ||  response.getStatusLine().getStatusCode() != 200){
				ret =  "";
			}else{
				ret =  EntityUtils.toString(response.getEntity(), "UTF-8");
			}
		} catch (Exception e) {
			ret = "";
		}
		
		return ret;
	}
	
	public Object getInfoFromRes(String content){
		
		return null;
	}
}
